/**
 * Created by Administrator on 2017/7/3.
 */
var vm_teamStyle = avalon.define({
    $id: "teamStyle",
    bannerArr: [],
    bossImg:'',
    columnContent: [],
    // columnTitle: []
})
getColumnId();
function getColumnId() {
    var pageId = getPageId('团队风采');
    var ColumnIdArr = [];
    console.log('pageId=' + pageId);
    var _basePath = getCatelogUrl(pageId);
    console.log(_basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        var tempOption;
        for (var i = 0, len = data.length; i < len; i++) {
            var name = conformName(data[i].name);
            tempOption = {
                "name": name,
                "number": data[i].number
            }
            ColumnIdArr[i] = tempOption;
        }
        console.log(ColumnIdArr);
        getColumnData(ColumnIdArr)
    }, _basePath)
}

var index = 0;
function getColumnData(ColumnIdArr) {
    var lenth = ColumnIdArr.length;
    console.log(lenth);
    var _basePath = getDataUrl(ColumnIdArr[index].number);
    console.log("getColumnData _basePath=" + _basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        vm_teamStyle.columnContent.push(data[0]);
        if (index == 0) {
            console.log('data[0].length = ' + data.length)
            for (var i = 0, len = data.length; i < len; i++) {
                var tempImhUrl = data[i].imageUrl;
                vm_teamStyle.bannerArr.push(spliceImgUrl(tempImhUrl));
            }
            console.log('vm_teamStyle.bannerArr=' + vm_teamStyle.bannerArr)
        }else if(index==1){
            vm_teamStyle.bossImg = spliceImgUrl(data[0].imageUrl)
        }
        if (index < lenth - 1) {
            index++;
            getColumnData(ColumnIdArr);
        }
    }, _basePath);
    console.log(vm_teamStyle.columnContent.length)
}
